package handler

import (
	"github.com/gin-gonic/gin"
	"log"
	"shop/shop-api/api/reponse"
	"shop/shop-api/api/request"
	"shop/shop-api/config"
	__ "shop/shop-srv/handler/proto"
)

func OrderList(c *gin.Context) {
	req := request.Order{}
	if c.ShouldBind(&req) != nil {
		reponse.Error(c, "绑定失败")
		return
	}
	r, err := config.ShopClient.OrderList(c, &__.OrderListReq{
		Id: int64(req.Id),
	})
	if err != nil {
		log.Fatalf("could not greet: %v", err)
	}
	reponse.Success(c, "校验成功", __.OrderListResp{
		ShopId:    r.ShopId,
		UserId:    r.UserId,
		PlaceTime: r.PlaceTime,
		Status:    r.Status,
	})
}
